- name: make the app be real
  hosts: os-masters:os-masters-stg
  user: root
  gather_facts: True

  vars_files:
    - /srv/web/infra/ansible/vars/global.yml
    - "/srv/private/ansible/vars.yml"
    - /srv/web/infra/ansible/vars/{{ ansible_distribution }}.yml

  roles:
  # The openshift/project role breaks if the project already exists:
  # https://pagure.io/fedora-infrastructure/issue/6404
  - role: openshift/project
    app: greenwave
    description: greenwave
    appowners:
    - mjia
    - dcallagh
  # These secret roles also break if the secret already exists.  Can only be run once.
  #- role: openshift/secret-file
  #  app: greenwave
  #  secret_name: greenwave-fedmsg-key
  #  key: fedmsg-greenwave.key
  #  privatefile: fedmsg-certs/keys/greenwave-greenwave-web-greenwave.app.os.stg.fedoraproject.org.key
  #  when: env == "staging"
  #- role: openshift/secret-file
  #  app: greenwave
  #  secret_name: greenwave-fedmsg-crt
  #  key: fedmsg-greenwave.crt
  #  privatefile: fedmsg-certs/keys/greenwave-greenwave-web-greenwave.app.os.stg.fedoraproject.org.crt
  #  when: env == "staging"
  #- role: openshift/secret-file
  #  app: greenwave
  #  secret_name: greenwave-fedmsg-key
  #  key: fedmsg-greenwave.key
  #  privatefile: fedmsg-certs/keys/greenwave-greenwave-web-greenwave.app.os.fedoraproject.org.key
  #  when: env != "staging"
  #- role: openshift/secret-file
  #  app: greenwave
  #  secret_name: greenwave-fedmsg-crt
  #  key: fedmsg-greenwave.crt
  #  privatefile: fedmsg-certs/keys/greenwave-greenwave-web-greenwave.app.os.fedoraproject.org.crt
  #  when: env != "staging"
  - { role: openshift/object, app: greenwave, file: imagestream.yml }
  - { role: openshift/object, app: greenwave, template: buildconfig.yml }
  - { role: openshift/start-build, app: greenwave, name: greenwave-docker-build }
  - { role: openshift/object, app: greenwave, template: configmap.yml }
  - { role: openshift/object, app: greenwave, file: service.yml }
  - { role: openshift/object, app: greenwave, file: route.yml }
  - { role: openshift/object, app: greenwave, file: deploymentconfig.yml }
  - { role: openshift/rollout, app: greenwave, name: greenwave-web }
